UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TtxRtNpcnwg+PBZK5taJbrfTI7GRm/RK4NovLU7Se6A=' 
WHERE 
  key_id = '2ab2c0848a46585d07f090705b3e8d63362c67f7bb6211873a27d5264cf9a632' 
  AND (
    token = 'TtxRtNpcnwg+PBZK5taJbrfTI7GRm/RK4NovLU7Se6A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052