UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Eb+PFF6HJvROWlXNWO2yLfWN4yz6vpwi4UAPQkLmuUE=' 
WHERE 
  key_id = '16d52a2f06d31d045dc0d157903d3d8f27aebd223d8dc0e476d0883b81264c01' 
  AND (
    token = 'Eb+PFF6HJvROWlXNWO2yLfWN4yz6vpwi4UAPQkLmuUE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032