UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fo9+3OqLh5/13I4VkvtZ8h5txs2edS7o/mLcIHjFouE=' 
WHERE 
  key_id = '191d49f479d968489f1b580af3a968160c8cee6b9e732c7a6766953146b57e46' 
  AND (
    token = 'fo9+3OqLh5/13I4VkvtZ8h5txs2edS7o/mLcIHjFouE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048