UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NY8qYf8GfXBjP9visTcuTVm1RxkaLDF5Ci5B6Z8UPbg=' 
WHERE 
  key_id = '0673e7a7252d69ac90e93e8f7d78333922fcc500ba37e72b1a606ed5c227e766' 
  AND (
    token = 'NY8qYf8GfXBjP9visTcuTVm1RxkaLDF5Ci5B6Z8UPbg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060