UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '36eCIVF9XglM2Rr5JADPxSbjtJmaAWv6NkdE5h1+Qjc=' 
WHERE 
  key_id = 'ca9efca74b0926cc7841a48694cd4e84fcbb6ccd52724280eadc91f6e0636c9d' 
  AND (
    token = '36eCIVF9XglM2Rr5JADPxSbjtJmaAWv6NkdE5h1+Qjc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048