UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I71LcgM/TiObn31dDzM2Pgjhqqf45osAD1sUk1aSoo8=' 
WHERE 
  key_id = 'aea0f110352850b44df74d2bb818e50c3ffdbbb72549588829c56aeec891c6c4' 
  AND (
    token = 'I71LcgM/TiObn31dDzM2Pgjhqqf45osAD1sUk1aSoo8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050