UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mN7c4JHiFYogsbCISZxWiScos6YhNSgoC5/nuET+5vg=' 
WHERE 
  key_id = '1630bdc726cf592ccc554ba31039e06137d423feaa1d1707d3c4fd0e96e8c44b' 
  AND (
    token = 'mN7c4JHiFYogsbCISZxWiScos6YhNSgoC5/nuET+5vg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033