UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7HdEy/on2+TsEzx6mOkeKVR0l+/mPemw2DaSi89bjos=' 
WHERE 
  key_id = 'aeaaa170b89bb320d0c26fa4db7031b2b259340a6614697d8f4e8a7fbf44e1fb' 
  AND (
    token = '7HdEy/on2+TsEzx6mOkeKVR0l+/mPemw2DaSi89bjos=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032