UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AMEr9zRYy8ECHc5+pt5vUrv43gjApr0fkza9UGzvnwg=' 
WHERE 
  key_id = '0e34653b9cb2618b5692e0c69f37709aecb14164336425d12dfbfb5ab2c7b720' 
  AND (
    token = 'AMEr9zRYy8ECHc5+pt5vUrv43gjApr0fkza9UGzvnwg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00069