UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u7hXW0cgQAutgf8SioEDggS3bssSkH8PMsN6W7ipaWY=' 
WHERE 
  key_id = '427e1d12fca2cdb54000e38a7890f2012b8df0a3d55cb31f6bb27bf3256de31a' 
  AND (
    token = 'u7hXW0cgQAutgf8SioEDggS3bssSkH8PMsN6W7ipaWY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050