UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PypWbtyNcjoHJB4W3Sqs0wPNgMt+n785CsMmoV4eY+Y=' 
WHERE 
  key_id = '79524b03a675ff1f46299121a707cb06d642d8bd6b157897868be13412ad9cae' 
  AND (
    token = 'PypWbtyNcjoHJB4W3Sqs0wPNgMt+n785CsMmoV4eY+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020