UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k7yvExXSa7MbOQJRQG0Dgf+jl8fZxVyH+mm8euT5vZ4=' 
WHERE 
  key_id = '341e73d56d222767d76325488c6237d5c368885a4ae1fb2d4855fdd58e40aea9' 
  AND (
    token = 'k7yvExXSa7MbOQJRQG0Dgf+jl8fZxVyH+mm8euT5vZ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032