UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tjj/cXs6vm6SSwKU47UT9txfgwpGYh8a5eOXwU8MunM=' 
WHERE 
  key_id = 'becb77dd326bc84cc797c34d54e2b49f604e6309b4e0537085bd5940169133f5' 
  AND (
    token = 'tjj/cXs6vm6SSwKU47UT9txfgwpGYh8a5eOXwU8MunM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029