UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eCsY0ag6e/a1b8iapWfzx/mzHxoNAhffSKMfVY7P1/M=' 
WHERE 
  key_id = '20c14af836c58c27c6dd83fe9cc5320b8602420136dc1386ec6a863b4fababf7' 
  AND (
    token = 'eCsY0ag6e/a1b8iapWfzx/mzHxoNAhffSKMfVY7P1/M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030