UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WGhhGT+41t0ISrM9GQgNNJBbvn9mRdu1geXM7doUIFY=' 
WHERE 
  key_id = '9cf4c523196e2037c6d236df985b2d116004478d5e05de84bdaba4a945c1d72f' 
  AND (
    token = 'WGhhGT+41t0ISrM9GQgNNJBbvn9mRdu1geXM7doUIFY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035