UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H3m4sd4U3U2DAJrIeTaIPoHtirXLLnei/75IVC/SWF4=' 
WHERE 
  key_id = 'a0c0b3dad6764da3dc191868e75615af54c6df478eb91ad232b8d3268f72ecc4' 
  AND (
    token = 'H3m4sd4U3U2DAJrIeTaIPoHtirXLLnei/75IVC/SWF4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040