UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O4QUI58mXAdk6T9Ltk21L+ksjXHJsgZZicBk4QKCYRk=' 
WHERE 
  key_id = '3d5edfa0e8fc5a893b60d5e10d43d53f7123f9adeec877e85739aa4e488a25f6' 
  AND (
    token = 'O4QUI58mXAdk6T9Ltk21L+ksjXHJsgZZicBk4QKCYRk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00067