UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XIknSW44uVmHfu+3cb9YMgIxpuvyAhH9c0/NcyhVzL0=' 
WHERE 
  key_id = '052c92b2f0b7b29237445ded671088b197a996a26ade678641334e563a392562' 
  AND (
    token = 'XIknSW44uVmHfu+3cb9YMgIxpuvyAhH9c0/NcyhVzL0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026