UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fq89QpuYxvReUHGN1NgnUjYPGDCurdKZ68fSkluV1Dc=' 
WHERE 
  key_id = '9009997d82cc5045007b5e86fac733351471106ed6325645af0bc7a258312069' 
  AND (
    token = 'fq89QpuYxvReUHGN1NgnUjYPGDCurdKZ68fSkluV1Dc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036