UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AZULdD9q7pgHFZYhveUw32UhYahq6WiwLx8iYbEpPt0=' 
WHERE 
  key_id = '9faa9f977ead87dccceb5f3c65b45188bda4cbae143e43fd414fdf963729e172' 
  AND (
    token = 'AZULdD9q7pgHFZYhveUw32UhYahq6WiwLx8iYbEpPt0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023