UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dnC8yDWjUzjP5r7RR2AtgDtUJAsnOb0EqKgA0AUBL+4=' 
WHERE 
  key_id = '9021344350fa9ddd189b308a993713129cb4754e81fa796ac7bb27853e7dd02c' 
  AND (
    token = 'dnC8yDWjUzjP5r7RR2AtgDtUJAsnOb0EqKgA0AUBL+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018