UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q77/jKftFNqpz+xaB/ecIFZFbE72MCcmXVmmbXHZqjg=' 
WHERE 
  key_id = '65591a47df4cc29d3100037edca867fe9e3b7ef05d95d9cf53c052db72ebd932' 
  AND (
    token = 'q77/jKftFNqpz+xaB/ecIFZFbE72MCcmXVmmbXHZqjg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035