UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ai+rlTsSCuaVbIjRQ5Z26nO0QcXbtM4GzOnxeXB6JD4=' 
WHERE 
  key_id = '84d3a6a720860b2db310a80fee7da3004f6503c8528d035e1240ab595fb7dcff' 
  AND (
    token = 'Ai+rlTsSCuaVbIjRQ5Z26nO0QcXbtM4GzOnxeXB6JD4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035