UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p7mqqbPYACkjsc4aeftDgx4La4yTjQz5s0zmKsanCzE=' 
WHERE 
  key_id = '68bda9975a27dbe3d8f1af250cafb5fb9929f3efbd2c100c4925e5145c234c11' 
  AND (
    token = 'p7mqqbPYACkjsc4aeftDgx4La4yTjQz5s0zmKsanCzE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040