UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T3LHywbZT9uLPdjDddrKvbO0UQ4sjdvDxDkCpjZqpnE=' 
WHERE 
  key_id = '7b47350edfa52c4e2c7ecf38a3747ff22931ce743f452956d0674b1fbef7883a' 
  AND (
    token = 'T3LHywbZT9uLPdjDddrKvbO0UQ4sjdvDxDkCpjZqpnE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033