UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J5tpUKdey3PHvC/QTBDQeyu3JVlETs2DZXK4j/vJ4ws=' 
WHERE 
  key_id = '0fcd68ed3b7699d48569ba95c05352a156017ffd6968e309f615c408824aa2ad' 
  AND (
    token = 'J5tpUKdey3PHvC/QTBDQeyu3JVlETs2DZXK4j/vJ4ws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027