UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EkN7xXUZLJYYlvroNgHik+c8ejtw1NpIYY7ZnekV4Ww=' 
WHERE 
  key_id = '21b5cfe6ef1046e9021ac447dc750f8a5a1e65b3bb78dab06ce81ed3ff17f987' 
  AND (
    token = 'EkN7xXUZLJYYlvroNgHik+c8ejtw1NpIYY7ZnekV4Ww=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021