UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CfhIh3nYIJoxlrpUAQVPaD1PPrUlY0ak8WmHPwcPUnU=' 
WHERE 
  key_id = 'fc4f754ed8c4aa3d05d434c6967c44963dfa2558dade5202b1be7b98637376ec' 
  AND (
    token = 'CfhIh3nYIJoxlrpUAQVPaD1PPrUlY0ak8WmHPwcPUnU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026