UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't8aXjH8A6ShH9y+K45hde8npepAlDf7fDnVcjvn51fE=' 
WHERE 
  key_id = 'e9c3a2b3cc6c6f45c4d2c20a6b9b0babccb1e653e5aeca907321f15f33613657' 
  AND (
    token = 't8aXjH8A6ShH9y+K45hde8npepAlDf7fDnVcjvn51fE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022