UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aKl3J977KyPoSnXwYBnl8kPUkPIE/DeFhM7BWnnOOgw=' 
WHERE 
  key_id = 'e805aa12a9478b4edcc8c16dccb6af1617ab6fbd4ed084d3811eeda21bb1f294' 
  AND (
    token = 'aKl3J977KyPoSnXwYBnl8kPUkPIE/DeFhM7BWnnOOgw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046