UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E8bMXBZ7aeXz6JKNUl6gvLagTNEs3mgCFf7/sAelqU0=' 
WHERE 
  key_id = '1d331d4875275119177c9097a67ae2cf4204031d7abec2657705b814815aab49' 
  AND (
    token = 'E8bMXBZ7aeXz6JKNUl6gvLagTNEs3mgCFf7/sAelqU0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050