UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Nt8b2Goyun11a7qQlrGrTulH7Du9jvEdHo2ZKV7mHu8=' 
WHERE 
  key_id = '5f289149d5eaa4e64843511ce0381f5a62517cf6aee15258f4a67c2c372dbcad' 
  AND (
    token = 'Nt8b2Goyun11a7qQlrGrTulH7Du9jvEdHo2ZKV7mHu8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017